package cn.com.wangluotongxin.admin.model.constants;

public enum DatabaseReleaseStatus {
    // 发布状态 0.未发布 1.发布中 2.发布成功 3.发布失败
    NO(0, "未发布"),
    RUNNING(1, "发布中"),
    SUCCESS(2, "发布成功"),
    FAIL(3, "发布失败");

    private Integer code;

    public Integer getCode() {
        return code;
    }

    private String name;

    public String getName() {
        return name;
    }

    public static DatabaseReleaseStatus getByCode(Integer code){
        if(code == null){
            return null;
        }else {
            DatabaseReleaseStatus[] databaseReleaseStatuses = values();
            for(DatabaseReleaseStatus databaseReleaseStatus : databaseReleaseStatuses){
                if(databaseReleaseStatus.getCode().equals(code)){
                    return databaseReleaseStatus;
                }
            }
        }
        return null;
    }

    DatabaseReleaseStatus(Integer code, String name){
        this.code = code;
        this.name = name;
    }
}
